module game
{
	/**格子不添加pop，因为涉及到移动 */
	export class BaseGrid extends eui.Component
	{
		/**格子的类型 */
		public type:number;
		private bg:eui.Image;
		private flag:eui.Image;

		private _isBlank:boolean;

		public constructor()
		{
			super();
			this.skinName = "resource/game_ui/BaseGrid.exml";
			this.addEventListener(egret.Event.COMPLETE,this.loaded,this);
		}

		public set isBlank(value:boolean)
		{
			this._isBlank = value;
			this.visible = !value;
		}

		public get isBlank():boolean
		{
			return this._isBlank;
		}

		public init():void
		{
			//生成1--6的随机数
			let rand = Math.floor(Math.random()*6);
		}

		protected loaded(): void
		{
			this.removeEventListener(egret.Event.COMPLETE,this.loaded,this);
			this.addChild(this.bg);
			this.addChild(this.flag);
		}

		public select(bool:boolean):void
		{
			this.flag.visible = !bool;
			// console.warn(this.flag.visible);
		}
	}
}